function [dct_data_remove] = FUN_plotDataDCTRemove(fig,data,motion)

size = length(data);
motion = motion(1:size);
sampletime = 0.01;                              %sample time that unit is second
t = 0:sampletime:(size-1) * sampletime;         %time point

samplefreq = 1/sampletime;                        %sample frequency that unit is Hz
f = (0:(size-1))/(size)*samplefreq;           %frequency point

oversampletime = 0.001;                              %sample time that unit is second
tq = 0:oversampletime:size * sampletime - oversampletime;
oversamplefreq = 1/oversampletime;     
fq = 0:(samplefreq/2)/(size*(oversamplefreq/samplefreq)):samplefreq/2 - 1/(size*(oversamplefreq/samplefreq));
% fq = 0:oversamplefreq/(size*4):oversamplefreq*(size*4-1)/(size*4);

dct_data = dct(data);
dct_move = dct(motion);   %acce DCT

figure(fig);clf();subplot(2,2,1);
plot(f/2,dct_data,'r',f/2,dct_move,'b');
title('Discrete Cosine Transform Analysis'); axis auto %axis([0 100 0 10^6]);
xlabel('Frequency/Hz'); ylabel('Amplitude/Value');
legend( 'dct_data', 'dct_move');

dct_data_spline = interp1(t,dct_data,tq,'pchip');
dct_move_spline = interp1(t,dct_move,tq,'pchip');

dct_minus = abs(dct_data_spline) - abs(dct_move_spline);
figure(1);clf();subplot(2,1,1);
plot(fq,dct_data_spline,'b',f/2,dct_data,'r');
legend( 'dct_data_spline','dct_data');
figure(1);subplot(2,1,2);
plot(fq,dct_move_spline,'b',f/2,dct_move,'r');
legend( 'dct_move_spline','dct_data');

figure(fig);subplot(2,2,3);
plot(fq,dct_minus,'b');
title('Discrete Cosine Transform minus Analysis'); axis auto %axis([0 100 0 10^6]);
xlabel('Frequency/Hz'); ylabel('Amplitude/Value');
legend( 'dct_minus');


dct_data_remove = dct_data_spline;
% dct_minus(dct_minus<5) = 0;
dct_index = find(dct_minus<5);
dct_data_remove(dct_index) = 0;
% dct_data_remove(183) = 0;
% dct_data_remove(184) = 0;
% dct_data_remove(185) = 0;
dct_data_remove = abs(dct_data_remove);
dct_data_remove = dct_data_remove(1:sampletime/oversampletime:end);

figure(fig);subplot(2,2,2);
plot(f/2,dct_data_remove,'b');
title('Discrete Cosine Transform remove Analysis'); axis auto %axis([0 100 0 10^6]);
xlabel('Frequency/Hz'); ylabel('Amplitude/Value');
legend( 'dct_remove');

idct_data = idct(dct_data);

figure(fig);subplot(2,2,4);
plot(t,idct_data);
title('Time Domain DCT Filtered Analysis');%axis([0 60 -200 200]);
xlabel('Time/s'); ylabel('Amplitude/Value')
legend( 'dct_remove');

end